package com.cpecc.model.system;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@Table(name = "SYS_WUZILB")
public class WuZiLB implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5638461513752162806L;

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(length = 32)
	private String id;	
	
	@Column(length = 16)
	private String leibieMC;
	
	@Column
	private int cengJi;
	
	@Column(length=50)
	private String miaoShu;
	
	@Column(length=16)
	private String leiBieJC;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parentID")
	private WuZiLB parent;
	
	@OneToMany(mappedBy="parent")
	@LazyCollection(LazyCollectionOption.EXTRA)
	private Set<WuZiLB> children;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getLeibieMC() {
		return leibieMC;
	}

	public void setLeibieMC(String leibieMC) {
		this.leibieMC = leibieMC;
	}	

	public int getCengJi() {
		return cengJi;
	}

	public void setCengJi(int cengJi) {
		this.cengJi = cengJi;
	}

	public String getMiaoShu() {
		return miaoShu;
	}

	public void setMiaoShu(String miaoShu) {
		this.miaoShu = miaoShu;
	}

	public String getLeiBieJC() {
		return leiBieJC;
	}

	public void setLeiBieJC(String leiBieJC) {
		this.leiBieJC = leiBieJC;
	}	

	public WuZiLB getParent() {
		return parent;
	}

	public void setParent(WuZiLB parent) {
		this.parent = parent;
	}	

	public Set<WuZiLB> getChildren() {
		return children;
	}

	public void setChildren(Set<WuZiLB> children) {
		this.children = children;
	}	

	public WuZiLB(String id, String leibieMC, int cengJi, String miaoShu,
			String leiBieJC, WuZiLB parent, Set<WuZiLB> children) {
		super();
		this.id = id;
		this.leibieMC = leibieMC;
		this.cengJi = cengJi;
		this.miaoShu = miaoShu;
		this.leiBieJC = leiBieJC;
		this.parent = parent;
		this.children = children;
	}

	public WuZiLB() {
		
	}	
	
}
